import random

def large():
    print('你输入的数字太大了！')

def small():
    print('你输入的数字太小了！')

def success(x):
    print('恭喜！你猜对了!你用了'+ str(x) +'次')

def randomGame():
    rannum = random.randint(1,100)
    
    print('这是一个猜数字游戏，你可以输入1到100之间的数字')
    
    for i in range(1,100):
        guess = int(input('请输入您猜的数字：'))
        if guess < rannum:
        	small()
        elif guess > rannum:
            large()
        else:
            success(i)
            break

randomGame()
